package com.sunleader.netboot.module.common.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Result<T> {
    private int code;
    private String msg;
    private T data;

    public Result(T data) {
        this.code = 200;
        this.msg = "";
        this.data = data;
    }
    public static <T> Result<T> failed(String msg){
        return Result.<T>builder().code(400).msg(msg).build();
    }
    public static <T> Result<T> success(T data){
        return Result.<T>builder().code(200).data(data).msg("").build();
    }
    public static <T> Result<T> success(){
        return Result.<T>builder().code(200).msg("").build();
    }
}
